package cn.doitedu.sql;

import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

public class _04_Mysql_cdc_connector_Demo {
    public static void main(String[] args) {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.enableCheckpointing(5000);
        env.getCheckpointConfig().setCheckpointStorage("file:///d:/ckpt");

        StreamTableEnvironment tenv = StreamTableEnvironment.create(env);


        tenv.executeSql(
                        " create table student_cdc(         "+
                                " id bigint,                         "+
                                " member_level_id bigint,            "+
                                " username string,                   "+
                                " nickname string,                   "+
                                " phone string,                      "+
                                " status int,                        "+
                                " create_time timestamp(3) ,         "+
                                " gender int,                        "+
                                " birthday date ,                    "+
                                " city string,                       "+
                                " job string,                        "+
                                " source_type int,                   "+
                                " integration int,                   "+
                                " growth int,                        "+
                                " luckey_count int,                  "+
                                " history_int,                       "+
                                " modify_time timestamp(3)           "+
                        " ) with (                          "+
                        "     'connector' = 'mysql-cdc',    "+
                        "     'hostname' = 'doitedu',       "+
                        "     'port' = '3306',              "+
                        "     'username' = 'root',          "+
                        "     'password' = 'root',          "+
                        "     'database-name' = 'doit46',   "+
                        "     'table-name' = 'student'      "+
                        " )                                 "
        );


        // 建表，映射hbase中的目标表
        tenv.executeSql("");




    }


}
